m,d = map(int,input().split())

if m>1:
    d = d + 31
if m>2:
    d = d + 28
if m>3:
    d = d + 31
if m>4:
    d = d + 30
if m>5:
    d = d + 31
if m>6:
    d = d + 30
if m>7:
    d = d + 31
if m>8:
    d = d + 31
if m>9:
    d = d + 30
if m>10:
    d = d + 31                        
if m>11:
    d = d + 30

d = d % 7

if d==5 or d==6:
    print("yes")
else:
    print("no")
